package pkleczek.bugbrain.laboratory.elements;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;

public class Node extends CircutElement {

	private static final Paint paint;

	private final RectF oval = new RectF();

	static {
		paint = new Paint();
		paint.setColor(Color.YELLOW);
	}

	@Override
	public void draw(Canvas canvas, int tileSize) {
		int halfSize = (int) ((getSize() - 1) * tileSize * 0.5 * 0.6);

		// +1, bo współrzędne określają lewy górny róg
		oval.set(getPosition().x * tileSize - halfSize, getPosition().y
				* tileSize - halfSize, (getPosition().x + 1) * tileSize
				+ halfSize, (getPosition().y + 1) * tileSize + halfSize);

		canvas.drawOval(oval, paint);
	}

	@Override
	public int getSize() {
		return 3;
	}

}
